#!/bin/sh

if [ $# -lt 1 ]; then
	echo "Cannot update headers, private header directory not specified"
	exit 1
fi

SPI_BASE="${1}"

for H in				\
	DHCPClientPreferences.h		\
	SCDynamicStore.h		\
	SCDynamicStoreCopyDHCPInfo.h	\
	SCDynamicStoreCopySpecific.h	\
	SCDynamicStoreKey.h		\
	SCNetworkConfiguration.h	\
	SCNetworkConnection.h		\
	SCPreferences.h			\
	SCPreferencesPath.h		\
	SCPreferencesSetSpecific.h	\
	SCSchemaDefinitions.h		\
	SystemConfiguration.h		\

do
	HACK=$(echo "_DO_NOT_INCLUDE_${H}" | tr '[:lower:]' '[:upper:]' | sed -e 's/\./_/')
	cat <<_END_OF_INPUT > "${SPI_BASE}/_${H}"
#ifndef	${HACK}
#define	${HACK}

/*
 * WARNING WARNING WARNING WARNING WARNING
 *
 * This is a PRIVATE/INTERNAL header file that is on the to-be-removed soon
 * list.  Please update your project to use :
 *	#include <SystemConfiguration/${H}>
 * or :
 *	#include <SystemConfiguration/SystemConfiguration.h>
 *
 * WARNING WARNING WARNING WARNING WARNING
 */
#ifndef	NO_TAPI_WARNINGS
#warning "Please #include <SystemConfiguration/${H}>, NOT <SystemConfiguration/_${H}>. See rdar://41937689 for details"
#endif	// NO_TAPI_WARNINGS

#endif	// ${HACK}

#include <SystemConfiguration/${H}>
_END_OF_INPUT
done

exit
